<template>
    <div class="home-contain">
        <h2>-------- 汉堡商城 ---------</h2>
        <goods :goodsList="goodsList"/>
    </div>
</template>

<script>
    import Goods from "./goods";
    import {httpGet} from '@/utils/http';
    import {goodsList} from "@/constant";

    export default {
        name: "home",
        components: {
            Goods
        },
        data() {
            return {
                goodsList: []
            }
        },
        mounted() {
            //请求首页商品数据
            httpGet('/data').then(res => {
                this.goodsList = res.data
            }, error => {
                this.goodsList = goodsList
            })
        }
    }
</script>

<style lang="less">
    .home-contain {
        h2 {
            margin: 20px 0;
            text-align: center;
            font-size: 25px;
            color: #F97F51;
            font-family: '华文行楷';
        }

        .box-card {
            width: 480px;
            margin: 20px auto;
        }
    }
</style>